package com.apes.autoparts.supplier.longsky;

import com.apes.autoparts.supplier.platform.SupplierPlatformItem;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * Created by lishikun on 2021/5/21 9:21
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = LongSkyDebug.CONST_TABLE_NAME)
public class LongSkyDebug extends BaseModel {
    public static final String CONST_TABLE_NAME = "long_sky_debug";

    @Id
    @Comment("流水码")
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "长远调试")
    private String id;

    @Comment("供应商")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "supplier_platform_item_id", referencedColumnName = "id")
    private SupplierPlatformItem supplierPlatformItem;

    @Comment("内部码")
    @Column(name = "CYID", length = 32, nullable = false)
    private String CYID;

    @Comment("厂牌")
    @Column(name = "CP", length = 128)
    private String CP;

    @Comment("零件编码")
    @Column(name = "NNO", length = 128)
    private String NNO;

    @Comment("零件名称")
    @Column(name = "NA1", length = 128)
    private String NA1;

    @Comment("库存数")
    @Column(name = "KCAMOUNT", columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    private double KCAMOUNT;

    @Comment("零售单价")
    @Column(name = "OPRC", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private double OPRC;

    @Comment("产地")
    @Column(name = "FA", length = 128)
    private String FA;

    @Comment("车型")
    @Column(name = "TY", length = 128)
    private String TY;

    @Comment("仓位")
    @Column(name = "POSI", length = 128)
    private String POSI;

    @Comment("库号")
    @Column(name = "DEPOTNO", length = 128)
    private String DEPOTNO;

    @Comment("分类码")
    @Column(name = "DC", length = 128)
    private String DC;

    @Comment("单位")
    @Column(name = "UNIT", length = 128)
    private String UNIT;

    @Comment("备注")
    @Column(name = "NOTE", length = 128)
    private String NOTE;

}
